package com.lkx.chain;

/**
 * ClassName: Lead
 * Function:  TODO
 * Date:      2019-08-06 10:40
 * author     likaixuan
 * version    V1.0
 */
public abstract class Lead {

    public Lead nextLead;

    public final void handleRequest(int money){

        if(money<=limit()){
            System.out.println(say());
        }else{
            System.out.println(this.getClass() + "没有权限批复本次[" + money + "]额度");
            if(nextLead != null) {
                nextLead.handleRequest(money);
            }
        }
    }

    public abstract int limit();
    public abstract String say();

}
